package com.itqf;

import com.itqf.dao.UserDao;
import com.itqf.factory.MyFactory;
import com.itqf.service.impl.UserServiceImpl;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/9
 * @Time: 上午10:05
 */
public class TestFactory {
    public  static  void  main(String[]args) throws  Exception{

        MyFactory myFactory = new MyFactory("factory.properties");
       //UserService userService = new UserServiceImpl();
        //获取Service的对象
        UserServiceImpl userService =(UserServiceImpl)myFactory.getBean("userService");
        UserDao userDao =(UserDao) myFactory.getBean("userDao");
        //依赖dao
        userService.setUserDao(userDao);

        userService.insert();
        userService.update();



    }

}
